const mongoose =require('mongoose')

const subMenuSchema = new mongoose.Schema({
  path: String,
  name: String,
  role: [String],
  meta: {
      title: String,
      icon: String,
      requiresAuth: Boolean,
      isPublic: Boolean
  },
  pathIndex: String
});
const baseSchema = new mongoose.Schema({
  path: String,
  name: String,
  redirect: String,
  role: [String],
  meta: {
    title: String,
    icon: String,
    requiresAuth: Boolean
  },
  subMenu: [subMenuSchema]
})
const menuSchema = new mongoose.Schema({
  orgId: String,
  menu: [baseSchema]
});
const menuModel = mongoose.model('menus', menuSchema)
module.exports = menuModel